package com.nb.cloud.doc.controller;

import cn.hutool.extra.pinyin.PinyinUtil;
import cn.hutool.json.JSONUtil;
import com.nb.cloud.doc.biz.ISearchBiz;
import com.nb.cloud.doc.model.PageVO;
import com.nb.cloud.doc.model.Result;
import com.nb.cloud.doc.model.dto.SearchDTO;
import com.nb.cloud.doc.model.vo.SearchListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 搜索 前端控制器
 * </p>
 *
 * @author 作者
 * @since 2024-08-04
 */
@RestController
@RequestMapping("/")
public class SearchController {

    @Autowired
    ISearchBiz searchBiz;


    @PostMapping("search")
    public Result<PageVO<SearchListVO>> search(@RequestBody SearchDTO searchDTO){
        System.err.println(JSONUtil.toJsonStr(searchDTO));
        PageVO<SearchListVO> searchList = searchBiz.search(searchDTO);
        return Result.OK(searchList);
    }





    public static void main(String[] args) {
        System.out.println(PinyinUtil.getPinyin("一年级",""));
    }
}
